package cn.zust.edu.cn;

public class Circle implements IShape{
	private Point ptCenter;
	private int radius;

	public Circle(Point center, int r) {
		this.ptCenter = center;
		this.radius = r;
	}

	@Override
	public double perimeter() {
		return 2 * Math.PI * radius;
	}

	@Override
	public double area() {
		return Math.PI * radius * radius;
	}

	@Override
	public void draw() {
		int diameter = 2 * radius;
		for (int y = -radius; y <= radius; y++) {
			StringBuilder sb = new StringBuilder();
			for (int x = -radius; x <= radius; x++) {
				double distance = Math.sqrt(x*x + y*y);
				sb.append(Math.abs(distance - radius) < 0.5 ? "*" : " ");
			}
			System.out.println(sb);
		}
	}
}
